<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>递归阶乘</title>
</head>
<body>


<script>

    function i(n){
        if (n === 1){
            return 1;
        }else {
            return n  * i(n - 1);
        }
    }

    //5 * (5 - 4)→ 4   } 24 * 5 = 120
    //4 * (4 - 1)→ 3   } 6 * 4 = 24
    //3 * (3 - 1)→ 2   } 2 * 3 = 6
    //2 * (2 - 1)→ 1   } 1 * 2 = 2

    console.log(i(5));
</script>
</body>
</html>